<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>个人信息 - 巷陌发现</title>
    <link rel="stylesheet" href="../static/bootstrap-icons/font/bootstrap-icons.css">
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        body {
            font-family: 'PingFang SC', 'Microsoft YaHei', sans-serif;
            background-color: #f5f7fa;
            color: #333;
            line-height: 1.6;
        }

        .container {
            max-width: 1000px;
            margin: 0 auto;
            background: white;
            box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
            border-radius: 8px;
            overflow: hidden;
            margin-top: 20px;
            margin-bottom: 20px;
        }

        /* 头部信息 */
        .profile-header {
            padding: 40px 5%;
            text-align: center;
            background: linear-gradient(120deg, #6a11cb 0%, #2575fc 100%);
            color: white;
            position: relative;
        }

        .profile-pattern {
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            opacity: 0.05;
            background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='1'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
        }

        .avatar {
            width: 140px;
            height: 140px;
            border-radius: 50%;
            border: 4px solid rgba(255, 255, 255, 0.4);
            margin: 0 auto 20px;
            overflow: hidden;
            position: relative;
            box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
            transition: transform 0.3s ease;
        }

        .avatar:hover {
            transform: scale(1.05);
        }

        .avatar img {
            width: 100%;
            height: 100%;
            object-fit: cover;
        }

        .avatar-upload-btn {
            position: absolute;
            bottom: 0;
            left: 0;
            right: 0;
            background: rgba(0, 0, 0, 0.7);
            color: white;
            border: none;
            padding: 8px;
            font-size: 12px;
            cursor: pointer;
            opacity: 0;
            transition: opacity 0.3s;
        }

        .avatar:hover .avatar-upload-btn {
            opacity: 1;
        }

        .username {
            font-size: 28px;
            font-weight: 600;
            margin-bottom: 10px;
            letter-spacing: 0.5px;
        }

        .bio {
            font-size: 16px;
            opacity: 0.95;
            max-width: 70%;
            margin: 0 auto;
            font-weight: 400;
        }

        .location {
            display: inline-flex;
            align-items: center;
            margin-top: 15px;
            font-size: 14px;
            background: rgba(255, 255, 255, 0.2);
            padding: 6px 15px;
            border-radius: 20px;
        }

        .location i {
            margin-right: 5px;
        }

        /* 个人信息表单 */
        .info-section {
            padding: 30px 5%;
        }

        .section-title {
            font-size: 20px;
            font-weight: 600;
            margin-bottom: 25px;
            color: #333;
            display: flex;
            align-items: center;
            justify-content: space-between;
        }

        .section-title i {
            color: #6a11cb;
            background: rgba(106, 17, 203, 0.1);
            width: 36px;
            height: 36px;
            border-radius: 8px;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 16px;
        }

        .action-buttons {
            display: flex;
            gap: 10px;
        }

        .btn {
            padding: 8px 16px;
            border: none;
            border-radius: 6px;
            cursor: pointer;
            font-size: 14px;
            font-weight: 500;
            display: flex;
            align-items: center;
            gap: 6px;
            transition: all 0.3s;
        }

        .btn-primary {
            background-color: #6a11cb;
            color: white;
        }

        .btn-primary:hover {
            background-color: #5a0dc8;
        }

        .btn-secondary {
            background-color: #6c757d;
            color: white;
        }

        .btn-secondary:hover {
            background-color: #5a6268;
        }

        .btn-outline {
            background-color: transparent;
            border: 1px solid #6a11cb;
            color: #6a11cb;
        }

        .btn-outline:hover {
            background-color: #6a11cb;
            color: white;
        }

        .form-grid {
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
            gap: 20px;
        }

        .form-group {
            margin-bottom: 20px;
        }

        .form-group.full-width {
            grid-column: 1 / -1;
        }

        .form-label {
            display: block;
            margin-bottom: 8px;
            font-weight: 500;
            color: #333;
        }

        .form-control {
            width: 100%;
            padding: 12px;
            border: 1px solid #eaeaea;
            border-radius: 6px;
            font-size: 14px;
            font-family: inherit;
            background-color: #f8f9fa;
            transition: all 0.3s;
        }

        .form-control:focus {
            border-color: #6a11cb;
            outline: 0;
            box-shadow: 0 0 0 0.2rem rgba(106, 17, 203, 0.25);
            background-color: white;
        }

        .form-control:read-only {
            background-color: #f8f9fa;
            color: #6c757d;
            cursor: not-allowed;
        }

        textarea.form-control {
            min-height: 100px;
            resize: vertical;
        }

        .form-hint {
            font-size: 12px;
            color: #6c757d;
            margin-top: 5px;
        }

        .required::after {
            content: " *";
            color: #dc3545;
        }

        /* 密码修改区域 */
        .password-section {
            background: #f8f9fa;
            padding: 25px;
            border-radius: 8px;
            margin-top: 20px;
        }

        .password-toggle {
            position: absolute;
            right: 12px;
            top: 50%;
            transform: translateY(-50%);
            background: none;
            border: none;
            color: #6c757d;
            cursor: pointer;
        }

        .password-input-group {
            position: relative;
        }

        /* 底部导航 */
        .bottom-nav {
            display: flex;
            background: white;
            border-top: 1px solid #eaeaea;
            padding: 20px 5%;
        }

        .nav-item {
            flex: 1;
            text-align: center;
            padding: 15px;
            color: #6c757d;
            font-weight: 500;
            border-radius: 8px;
            transition: all 0.2s ease;
            cursor: pointer;
        }

        .nav-item.active {
            color: #6a11cb;
            background: rgba(106, 17, 203, 0.1);
        }

        .nav-item:hover {
            color: #6a11cb;
        }

        .nav-item i {
            font-size: 20px;
            margin-bottom: 5px;
        }

        /* 响应式设计 */
        @media (max-width: 768px) {
            .form-grid {
                grid-template-columns: 1fr;
            }

            .action-buttons {
                flex-direction: column;
            }

            .btn {
                width: 100%;
                justify-content: center;
            }

            .profile-header {
                padding: 30px 5%;
            }

            .avatar {
                width: 120px;
                height: 120px;
            }

            .username {
                font-size: 24px;
            }

            .bio {
                font-size: 14px;
                max-width: 90%;
            }
        }

        @media (max-width: 480px) {
            .info-section {
                padding: 20px 5%;
            }

            .section-title {
                flex-direction: column;
                align-items: flex-start;
                gap: 15px;
            }

            .action-buttons {
                width: 100%;
            }
        }
    </style>
</head>
<body>
<div class="container">
    <!-- 头部信息 -->
    <div class="profile-header">
        <div class="profile-pattern"></div>
        <div class="avatar">
            <img src="https://images.unsplash.com/photo-1554151228-14d9def656e4?ixlib=rb-4.0.3&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=686&q=80" alt="头像">
            <button class="avatar-upload-btn" onclick="document.getElementById('avatarInput').click()">
                <i class="bi bi-camera"></i> 更换头像
            </button>
            <input type="file" id="avatarInput" accept="image/*" style="display: none;" onchange="handleAvatarUpload(event)">
        </div>
    </div>

    <!-- 个人信息表单 -->
    <div class="info-section">
        <div class="section-title">
            <span><i class="bi bi-person-circle"></i> 基本信息</span>
            <div class="action-buttons">
                <button class="btn btn-outline" id="editBtn" onclick="toggleEditMode()">
                    <i class="bi bi-pencil"></i> 编辑信息
                </button>
                <button class="btn btn-primary" id="saveBtn" onclick="saveInfo()" style="display: none;">
                    <i class="bi bi-check-lg"></i> 保存修改
                </button>
            </div>
        </div>

        <form id="personalInfoForm">
            <div class="form-grid">
                <div class="form-group">
                    <label class="form-label required" for="realName">真实姓名</label>
                    <input type="text" class="form-control" id="realName" name="realName" value="张美丽" readonly required>
                </div>

                <div class="form-group">
                    <label class="form-label required" for="gender">性别</label>
                    <select class="form-control" id="gender" name="gender" disabled required>
                        <option value="男">男</option>
                        <option value="女" selected>女</option>
                    </select>
                </div>

                <div class="form-group">
                    <label class="form-label required" for="age">年龄</label>
                    <input type="number" class="form-control" id="age" name="age" value="28" min="18" max="100" readonly required>
                </div>

                <div class="form-group">
                    <label class="form-label required" for="idCard">身份证号</label>
                    <input type="text" class="form-control" id="idCard" name="idCard" value="310101199501012345" readonly required>
                    <div class="form-hint">身份证号一旦设置不可修改</div>
                </div>

                <div class="form-group">
                    <label class="form-label required" for="phone">手机号</label>
                    <input type="tel" class="form-control" id="phone" name="phone" value="13800138000" readonly required>
                </div>

                <div class="form-group">
                    <label class="form-label required" for="email">邮箱</label>
                    <input type="email" class="form-control" id="email" name="email" value="zhangmeili@example.com" readonly required>
                </div>

                <div class="form-group">
                    <label class="form-label required" for="username">账号</label>
                    <input type="text" class="form-control" id="username" name="account" value="foodexplorer" readonly required>
                    <div class="form-hint">账号一旦设置不可修改</div>
                </div>

                <div class="form-group full-width">
                    <label class="form-label" for="bio">个人简介</label>
                    <textarea class="form-control" id="bio" name="description" placeholder="请简单介绍一下自己..." readonly>热爱美食与旅行的探店达人，喜欢分享真实体验和发现城市中的隐藏宝藏。专注于发现各地特色美食，用镜头记录美好生活。</textarea>
                </div>

            </div>
        </form>

        <!-- 密码修改区域 -->
        <div class="password-section">
            <h3 class="section-title">
                <i class="bi bi-shield-lock"></i> 密码修改
            </h3>

            <div class="form-grid">
                <div class="form-group">
                    <label class="form-label required" for="currentPassword">当前密码</label>
                    <div class="password-input-group">
                        <input type="password" class="form-control" id="currentPassword" name="currentPassword">
                        <button type="button" class="password-toggle" onclick="togglePassword('currentPassword')">
                            <i class="bi bi-eye"></i>
                        </button>
                    </div>
                </div>

                <div class="form-group">
                    <label class="form-label required" for="newPassword">新密码</label>
                    <div class="password-input-group">
                        <input type="password" class="form-control" id="newPassword" name="newPassword">
                        <button type="button" class="password-toggle" onclick="togglePassword('newPassword')">
                            <i class="bi bi-eye"></i>
                        </button>
                    </div>
                    <div class="form-hint">密码长度至少8位，包含字母和数字</div>
                </div>

                <div class="form-group">
                    <label class="form-label required" for="confirmPassword">确认新密码</label>
                    <div class="password-input-group">
                        <input type="password" class="form-control" id="confirmPassword" name="confirmPassword">
                        <button type="button" class="password-toggle" onclick="togglePassword('confirmPassword')">
                            <i class="bi bi-eye"></i>
                        </button>
                    </div>
                </div>

                <div class="form-group">
                    <button class="btn btn-primary" onclick="changePassword()" style="margin-top: 28px;">
                        <i class="bi bi-key"></i> 修改密码
                    </button>
                </div>
            </div>
        </div>
    </div>


</div>
<script src="../static/js/jquery.js"></script>
<script src="../static/js/jquery.cookie.js"></script>
<script src="../static/js/userInformation.js"></script>
</body>
</html>